import type { UniverseType } from "./index";
import type { UniverseCategory } from "./UniverseCategory";

export class UniverseGroup {
  // 组 ID 整数
  id!: number;

  // 名称字符串
  name!: string;

  // 是否已发布的布尔值
  published!: boolean;

  parent!: UniverseCategory;
  children: UniverseType[] = [];
  static fromGroup(group: any, parent: UniverseCategory) {
    const universeGroup = new UniverseGroup();
    universeGroup.id = group.group_id;
    universeGroup.name = group.name;
    universeGroup.published = group.published;
    parent.children.push(universeGroup);
    return universeGroup;
  }
}
